﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;
using Isuka.Iteration;

namespace Isuka.Spiritual
{
    public struct RuleResult<T>
        where T : IEquatable<T>
    {
        public readonly IBidirectionalIterator<T> Iterator;

        public readonly bool Match;

        public RuleResult(IBidirectionalIterator<T> it, bool match)
        {
            Contract.Requires(it != null);

            Iterator = it.Copy();
            Match = match;
        }

        #region ContractInvariantMethod

        [ContractInvariantMethod]
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = "Required for code contracts.")]
        private void ObjectInvariant()
        {
            Contract.Invariant(Iterator != null);
        }

        #endregion

    }
}
